Repository navigation
feat: 异步将LLM调用原始日志写入 AWS S3 - #1
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
service/raw_log_s3.go实现异步上传器,支持通过环境变量开关RAW_LOG_S3_ENABLED和相关RAW_LOG_S3_*配置(bucket/region/access key/secret/session token/prefix/队列长度/worker 数/最大日志字节数)。PUT上传,上传失败仅记录系统错误,不影响请求响应。relay/channel/api_request.go中为所有 HTTP relay 请求统一准备可重复读取的请求体(新增prepareReusableBody,设置req.GetBody/req.Body/ContentLength),并在doRequest成功返回上游响应后调用service.AttachRawLogCapture以捕获并异步上传原始日志。captureReadCloser包装并按环境配置的最大字节数截断缓存,发送时将包含请求头、请求体、响应体、状态码、模型/渠道/用户等上下文信息,队列满时会记录 warn 并丢弃以保护主路径。Testing
go test ./servicewhich completed successfully.go test ./relay/channel -run TestNonExistentfor quick compile checks on modified package which completed successfully.go test ./relay/... -run TestNonExistentwhich reported failures in existing repository files (format/fmtusage) unrelated to these changes; those are pre-existing build issues and not introduced by this PR.Codex Task